import os

def create_desktop_file():
    autostart_dir = os.path.expanduser('~/.config/autostart')
    if not os.path.exists(autostart_dir):
        os.makedirs(autostart_dir)

    desktop_file_content = f"""[Desktop Entry]
Type=Application
Exec=/usr/bin/python3 /path/to/vnc_recorder.py
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=VNC Recorder
Comment=Record VNC user activities
"""

    desktop_file_path = os.path.join(autostart_dir, 'vnc_recorder.desktop')
    with open(desktop_file_path, 'w') as f:
        f.write(desktop_file_content)

    os.chmod(desktop_file_path, 0o755)
    print('VNC Recorder 自动启动配置已创建。')

if __name__ == "__main__":
    create_desktop_file()